//
//  UIView+Extension.swift
//  HomeSchoolDemo
//
//  Created by rimi on 2016/10/13.
//  Copyright © 2016年 黄华强. All rights reserved.
//

import UIKit

extension UIView {
    
    
    
     func getMyView(bgColor:UIColor,bgTitle:String) {
        
        let ctx = UIGraphicsGetCurrentContext()
        ctx?.saveGState()
        ctx?.move(to: CGPoint(x: 0, y: 0))
        ctx?.addLine(to: CGPoint(x: 28, y: 0))
        ctx?.addLine(to: CGPoint(x: 28, y: 30))
        ctx?.addLine(to: CGPoint(x: 14, y: 22))
        ctx?.addLine(to: CGPoint(x: 0, y: 30))
        
        
        
        ctx?.closePath()
        bgColor.setFill()
        
        ctx?.drawPath(using: .fillStroke)
        
        (bgTitle as NSString).draw(in: CGRect(x: 3, y: 5, width: 28, height: 20), withAttributes: [NSFontAttributeName:UIFont.systemFont(ofSize: 11),NSForegroundColorAttributeName:#colorLiteral(red: 1, green: 1, blue: 1, alpha: 1)])
        
    }
    
    
}
